#ifndef __DIFFNORMALGO_H
#define __DIFFNORMALGO_H

#include "../../bass/db/Database.h"
#include "../krimp/KrimpAlgo.h"
#include "../../qtils/Config.h"


class DiffNormAlgo : public KrimpAlgo {
public:   
    static const string NAME;
    
    DiffNormAlgo(CodeTable** combinedCTs, uint8 numSplits, Config* config);
	~DiffNormAlgo();
    string GetShortName();
    void SetReportIter(const bool b) { mReportIteration = b; }
    void SetReportIterStyle(ReportType repIter) { mReportIterType = repIter; }
    
    virtual void Run() = 0;
    void BindCTsToDBs(Database **dbSplits, ItemSetType isType, uint32 maxCTElemLength);
    static DiffNormAlgo* CreateAlgo(ItemSetType isType, Config* config, uint8 numSplits);
    static CodeTable** CreateCombinedCT(ItemSetType isType, uint8 numSplits);

protected:
    // legacy book-keeping for SLIM
    bool mWriteLogFile;
    FILE *mLogFile;
    bool mReportIteration;
    ReportType mReportIterType;
    string mCTFile;
    double mScreenReportBits;

    // book keeping for DIFFNORM
    
    // We do not materialize individual code tables. Instead we materialize the 
    // combined code tables (CT_i + CT_common) which are obtained by combining 
    // the specific code tables with common code table. 
    CodeTable **mCombinedCTs; // IMPORTANT: Common CT is not materialized
    uint32 mNumDBSplits;
};

#endif // __DIFFNORMALGO_H
